// https://leetcode.cn/problems/split-with-minimum-sum/description/

func splitNum(num int) int {
    rec := [11]int{}
	for num > 0 {
		rec[num % 10]++
		num /= 10
	}
	a, b := 0, 0
	for i := 1; i < 11; i++ {
		for j := 1; rec[i] > 0; rec[i]-- {
			if j & 1 == 1 {
				a = 10 * a + rec[i]
			} else {
				b = 10 * b + rec[i]
			}
		}
	}
	return a + b
}